package com.sfzlot.dev.netty.bean.bussiness;

/**
 * 行业细分
 * @author xieqi
 *
 */
public interface Subdivide{
	public String getComment();
	public int getCode();
	
	/**Industry-SMARTHOME：智能家庭的细分行业**/
	enum SmartFamily implements Subdivide{
		SMARTHOME(0x01); 	// 智能家居
		
	    @Override
		public int getCode() {
			return code;
		}

		private int code;
		SmartFamily(int code){
	        this.code = code;
	    }

	    /**
	     * 根据code获取数据单元加密方式
	     * @param code
	     * @return
	     */
		public static SmartFamily get(int code){
	        for (SmartFamily smartFamily : SmartFamily.values()) {
	            if (smartFamily.code == code) {
	                return smartFamily;
	            }
	        }
	        return null;
	    }
		
		 /**
	     * 根据码获取命令对应的备注
	     * 
	     */
	    @Override
		public String getComment(){
	    	switch (this) {
				case SMARTHOME:
					return "智能家居";
			default:
				break;
	    	}
			return null;
	    }
    }
	
	/**Industry-RETAILSERVICE：零售服务的细分行业**/
	enum RetailService implements Subdivide{
		SELFSERVICE(0x01), 	// 自助终端
		INTELLIGENTADV(0x03); 	// 智能广告
		
	    @Override
		public int getCode() {
			return code;
		}

		private int code;
		RetailService(int code){
	        this.code = code;
	    }

	    /**
	     * 根据code获取数据单元加密方式
	     * @param code
	     * @return
	     */
		public static RetailService get(int code){
	        for (RetailService retailService : RetailService.values()) {
	            if (retailService.code == code) {
	                return retailService;
	            }
	        }
	        return null;
	    }
		
		 /**
	     * 根据码获取命令对应的备注
	     * 
	     */
	    @Override
		public String getComment(){
	    	switch (this) {
				case SELFSERVICE:
					return "自助终端";
			default:
				break;
	    	}
			return null;
	    }
    }

//    public static void main(String[] args) {
//    	Subdivide food = Subdivide.SmartFamily.SMARTHOME;
//        System.out.println("==>"+food.toString());
//    }
}
